//游游的水果大礼包
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n=sc.nextLong();
        long m=sc.nextLong();
        long a=sc.nextLong();
        long b=sc.nextLong();
        long res=0;
        for(int x=0;x <= Math.min(n/2,m);x++){
            long y=Math.min(n-2*x,(m-x)/2);
            res=Math.max(res,a*x+b*y);
        }
        System.out.print(res);
    }
}




//DP31 买卖股票的最好时机(二)


 class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int ans=0;
        Stack<Integer> stack=new Stack<>();
        for(int i=0;i<n;i++){
            int num=in.nextInt();
            if(stack.isEmpty()){
                stack.add(num);
                continue;
            }
            if(!stack.isEmpty()&&num>stack.peek()){
                ans+=(num-stack.pop());
            }
            stack.add(num);
        }

        System.out.print(ans);
    }
}




//OR62 倒置字符串

class Main2 {
    public static void main(String[] args) throws IOException{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s = reader.readLine();
        StringBuffer tmp=new StringBuffer();//存储单个单词
        ArrayList<String> arr=new ArrayList<>();//存储每个单词

        for(int j=s.length()-1;j>=0;j--){
            char ch = s.charAt(j);
            if(ch!=' '){
                tmp.append(ch);
            }else{
                if(tmp.length()!=0){
                    arr.add(tmp.reverse().toString());
                    tmp=new StringBuffer();
                }
            }
        }
        if(tmp.length()!=0){
            arr.add(tmp.reverse().toString());
        }
        for(int k=0;k<arr.size();k++){
            System.out.print(arr.get(k)+" ");
        }
    }


    //另一种方法
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] list = s.split(" ");
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < list.length; i++) {
            stringBuffer.append(list[list.length - i-1]).append(" ");
        }
        System.out.println(stringBuffer.toString());

    }

}